<?php
session_start();
if(isset($_SESSION['username'])){
    $username = $_SESSION['username'];
    include('./connect.php');
    if ($conn->connect_error) {
        echo '数据库连接失败！';
        exit(0);
    } else {
        //查询目录
        $sql_cata_select = "select * from cata where cata_user = '$username'";
        
        $result = mysqli_query($conn,$sql_cata_select);
        // if (!$result) {
        //     printf("Error: %s\n", mysqli_error($conn));
        //     exit();
        // }
        
        $number = mysqli_num_rows($result);

        if ($number) {
            $cata_id_arr = array();
            $cata_name_arr = array();
            while($row=mysqli_fetch_assoc($result)){
                $cata_id_arr[] = $row['cata_id'];
                $cata_name_arr[] = $row['cata_name'];
            }
        }
    }
}

?>